{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Predicting Red Wine Quality with New Method\n",
    "\n",
    "## Wine Data\n",
    "Data from http://archive.ics.uci.edu/ml/datasets/Wine+Quality\n",
    "\n",
    "### Citations\n",
    "P. Cortez, A. Cerdeira, F. Almeida, T. Matos and J. Reis. \n",
    "Modeling wine preferences by data mining from physicochemical properties.\n",
    "In Decision Support Systems, Elsevier, 47(4):547-553. ISSN: 0167-9236.\n",
    "\n",
    "Available at:\n",
    "- [@Elsevier](http://dx.doi.org/10.1016/j.dss.2009.05.016)\n",
    "- [Pre-press (pdf)](http://www3.dsi.uminho.pt/pcortez/winequality09.pdf)\n",
    "- [bib](http://www3.dsi.uminho.pt/pcortez/dss09.bib)\n",
    "\n",
    "Dua, D. and Karra Taniskidou, E. (2017). UCI Machine Learning Repository [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science.\n",
    "## Setup"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "\n",
    "red_wine = pd.read_csv('../../ch_09/data/winequality-red.csv')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Making the `high_quality` column"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    0.86429\n",
       "1    0.13571\n",
       "Name: high_quality, dtype: float64"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "red_wine['high_quality'] = pd.cut(red_wine.quality, bins=[0, 6, 10], labels=[0, 1])\n",
    "red_wine.high_quality.value_counts(normalize=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Building your first Support Vector Machine"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.pipeline import Pipeline\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "from sklearn.svm import SVC\n",
    "\n",
    "y = red_wine.pop('high_quality')\n",
    "X = red_wine.drop(columns=['quality'])\n",
    "\n",
    "X_train, X_test, y_train, y_test = train_test_split(\n",
    "    X, y, test_size=0.1, random_state=0, stratify=y\n",
    ")\n",
    "\n",
    "pipeline = Pipeline([\n",
    "    ('scale', StandardScaler()), ('svm', SVC(C=5, random_state=0, probability=True))\n",
    "]).fit(X_train, y_train)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Evaluating the SVM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "quality_preds = pipeline.predict(X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              precision    recall  f1-score   support\n",
      "\n",
      "           0       0.92      0.94      0.93       138\n",
      "           1       0.56      0.45      0.50        22\n",
      "\n",
      "   micro avg       0.88      0.88      0.88       160\n",
      "   macro avg       0.74      0.70      0.71       160\n",
      "weighted avg       0.87      0.88      0.87       160\n",
      "\n"
     ]
    }
   ],
   "source": [
    "from sklearn.metrics import classification_report\n",
    "print(classification_report(y_test, quality_preds))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x58ce330>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAElCAYAAAALP/6mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcm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8GYPPmzVxxxRX07NmTbt268cILLxQ7x2OPPcZ114VZT4cPH87111/PSSedRPv27ZkyZUp8v3vuuYeePXvSpUsXbrnllkq/1kyWFKYC10Vz4B4PbHL3VRmMR0SqObOSRyp/5JHzGDmyBwDjxs1j1KhpJe7rXr4P0yVLljBhwgR69+7NFVdcwdixY7nuuuu4+eabAbj00kuZNm0a559/PnfddRdffPEFe+21Fxs3bgTg9ttv54wzzuDRRx9l48aN9OrVi7POOqvUc65atYq33nqLxYsXM2DAAAYNGsSMGTP49NNPef/993F3BgwYwJw5czjllFPKdT2lSWeX1MmEuWaPMrM8M7vSzK42s6ujXaYT5uhdSpjy8Np0xSIisidatWpF7969ARg6dChvvfUWs2bN4vjjj6dz587MnDmTRYsWAdClSxeGDBnCpEmTqFcvfO+eMWMGd911F127duW0005j27ZtfPnll6We84ILLqBOnTp07NiRb775Jn6cGTNm0K1bN7p3787ixYv59NNPK/Va01ZScPeLy9juhEnMRURSkuo3/JEje8RLDZWhaDdPM+Paa68lNzeXVq1aMXr06Pi9AS+99BJz5sxh6tSp3HbbbSxatAh35x//+AdHHXVUoePEPuyT2WuvveLLsaopd+emm25i1KhRlXVpxWjsIxGRMnz55Ze8E3Vnnzx5MieffDIATZs2JT8/P17nv3v3blasWMHpp5/O3XffzcaNG8nPz+ecc87hwQcfjH+4z58/v0JxnHPOOTz66KPk5+cD8NVXX7F69eo9vbxCNMyFiEgZjjnmGCZOnMioUaPo0KED11xzDRs2bKBz5860bduWnj17ArBr1y6GDh3Kpk2bcHduuOEGDjjgAH7729/ys5/9jC5duuDutG3blmnTSm7zKEmfPn345JNPOPHEEwFo1KgRkyZNolmzZpV2rTVuOs6cnByv0CQ7/fvD9OkwbVpYFpFq75NPPuGYY47JdBg1TrL3zczmuXtOWa9V9ZGIiMQpKYiISJySgoiIxCkpiIhInJKCiIjEKSmIiEickoKISBVp27Yta9eu3eN90klJQURE4pQURERKsWzZMo4++miuuuoqOnXqxJAhQ3jttdfo3bs3HTp04P3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K/+8VVRuTwlygg5m1M7MGhIbkqUX2mQoMi5YHATM9asGpocq85qgq5RFCQqjp9cxQxjW7+yZ3b+rubd29LaEdZYC752Ym3EqRyt/284ROBZhZU0J10udVGmXlSuWavwTOBDCzYwhJYU2VRlm1pgKXRb2QTgA2ufuqyjp4ras+cvedZnYd8Cqh58Kj7r7IzMYAue4+FZhAKGIuJZQQBmcu4j2X4jXfAzQC/h61qX/p7gMyFvQeSvGaa5UUr/lVoI+ZfQzsAn7l7usyF/WeSfGafwGMN7MbCNUow2vylzwzm0yo/msatZPcAtQHcPe/ENpN+gFLgS3A5ZV6/hr83omISCWrjdVHIiJSQUoKIiISp6QgIiJxSgoiIhKnpCAiInFKCiJFmNkuM1tgZv82sxfN7IBKPv5wM3soWh5tZr+szOOL7AklBZHitrp7V3fvRLiP5ceZDkikqigpiJTuHRIGGzOzX5nZ3Ggc+1sT1l8WrfvQzB6P1p0fzdcx38xeM7NDMhC/SLnUujuaRSqLmdUlDJ8wIXrehzCOUC/CoGRTzewUYB1hTKne7r7WzA6KDvEWcIK7u5ldBfyacPetSLWlpCBS3N5mtgBoC8wD/hmt7xM95kfPGxGSxHHAFHdfC+DuscEVWwJPR2PdNwC+qJLoRfaAqo9Eitvq7l2BNoQP81ibggF3Ru0NXd39CHefEK1PNl7Mg8BD7t4ZGEUYqE2kWlNSECmBu28Crgd+aWb1CYOyXWFmjQDMrIWZNQNeBy40sybR+lj10f7AV9HyMERqAFUfiZTC3eeb2YfAYHd/PBqa+Z1opNl8YGg0auftwBtmtotQvTScMCPY383sK8LQ3e0ycQ0i5aFRUkVEJE7VRyIiEqekICIicUoKIiISp6QgIiJxSgoiIhKnpCAiInFKCiIiEvf/ARkAlVo9DapxAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from ml_utils.classification import plot_pr_curve\n",
    "\n",
    "plot_pr_curve(y_test, pipeline.predict_proba(X_test)[:,1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x128aead0>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUgAAAEWCAYAAAAEkA60AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAHX9JREFUeJzt3Xu8FXW9//HXewMpyU2u3jLSQ3rU1BLNC15KS0lSPHnNTI1f5C+t00/NUktILSszy5PpwZ8mapEW4gXvx5+opKagmFJm5aVUAgRBUFDBz++Pma2L3Z691157rVlr1n4/fcxjrTUza+az2fLmO/Od+Y4iAjMz+1ct9S7AzKxROSDNzDI4IM3MMjggzcwyOCDNzDI4IM3MMjggbR2S+kq6WdJySb/pxnaOlnRnNWurB0m3STq23nVYfTggC0rSZyXNkbRS0oL0L/KYKmz6UGAEMCQiDqt0IxHxy4j4ZBXqWYekfSSFpOvbzN8hnT+rzO1MlnRNZ+tFxNiImFphuVZwDsgCknQy8BPgeyRhtjnwc+DgKmz+/cDTEbGmCtuqlcXA7pKGlMw7Fni6WjtQwn8/erqI8FSgCRgIrAQO62Cd9UgC9KV0+gmwXrpsH+AF4BRgEbAAOD5d9h3gTeCtdB8TgMnANSXbHgkE0Dv9fBzwDLACeBY4umT+7JLv7Q48AixPX3cvWTYLOAf4XbqdO4GhGT9ba/2XAiem83ql884CZpWs+1PgH8CrwFxgz3T+AW1+zsdL6vhuWscq4N/Sef8rXX4J8NuS7f8AuBtQvf+/8FSbyf9CFs9uwPrAjA7WORPYFdgR2AHYBfhWyfKNSIJ2U5IQvFjShhExiaRVem1E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Q+nyx4Evpaucz9wKj68bjRPAVtIGpl+PqJ+pVg1+F+wxjKD5LD5cSCA0yLin+my+4FPRsRfJT1P0op0QDaQiFgl6cvA7ZJe5t1/3KygfKuhWRVJ6hcRKyUJuBj4S0RcWO+6rDI+xDarri9KmgfMBwaS9GpbQbkFaWaWwS1IM7MMDkgzswwOSDOzDA5I6zZJh0gKSVt3st5xkjbpxn72aXNvs1lNOSCtGo4CZgNHdrLecUDFAWmWNwekdYukfsAewARKAlLSaemIRI9L+n462s1o4JeS5qWj4DwnaWi6/mhJs9L3u0h6QNJj6etW+f9kZr6TxrpvPHB7RDwtaamkj5AMwjAe+GhEvC5pcEQslXQScGpEzAFIrqVu11PAXhGxJh2I9nuUjJpjlhcHpHXXUcBP0ve/Tj+3AL+IiNcBImJpF7c5EJgqaRTJLZceFszqwgFpFZM0BPg4sJ2kAHqRBNr09LUza3j3NM/6JfPPAe6JiEPSgR9mValksy7xOUjrjkOBqyLi/RExMiLeBzwLLAW+IOm9AJIGp+uvAPqXfP85YKf0fekh9EDgxfT9cbUp3axzDkjrjqNIRiAqNZ2kp/omYE56X3Lrw6quBC5t7aQBvgP8VNL9JOMjtvohcJ6k35G0Ss3qwvdim5llcAvSzCyDA9LMLIMD0swsgwPSzCyDA9LMLIMD0swsgwPSzCzD/wfXaPfTNdouYgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from ml_utils.classification import confusion_matrix_visual\n",
    "\n",
    "confusion_matrix_visual(y_test, quality_preds, ['low', 'high'])"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
